Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support basic webassembly debugging #1791

Merged
merged 2 commits into from
Aug 27, 2023

Conversation

connor4312
Copy link
Member

Supports viewing, stepping through, and setting breakpoints in
webassembly (decompiled as WAT) in the editor. Includes a
basic tmLanguage for WAT.

Unfortunately we eagerly have to decompile WASM in order to get line
mappings to show e.g. in breakpoints. Location mapping is currently
mostly synchronous and I didn't want to make everything async
for webassembly. However, we don't keep the WAT source in memory,
instead request it again if it's needed. I opted to do this to reduce
memory usage for user applications that just happen to contain WASM
where they aren't always interested in debugging it.

For #1789
Fixes #1715 on the way

Supports viewing, stepping through, and setting breakpoints in
webassembly (decompiled as WAT) in the editor. Includes a
basic tmLanguage for WAT.

![](https://memes.peet.io/img/23-08-b7617299-9f8d-41c9-8fe0-ada8a3c57966.png)

Unfortunately we eagerly have to decompile WASM in order to get line
mappings to show e.g. in breakpoints. Location mapping is currently
mostly synchronous and I didn't want to make everything async
for webassembly. However, we don't keep the WAT source in memory,
instead request it again if it's needed. I opted to do this to reduce
memory usage for user applications that just happen to contain WASM
where they aren't always interested in debugging it.

For #1789
Fixes #1715 on the way
// If we see we want to set breakpoints in file by source reference ID but
// it doesn't exist, they were probably from a previous section. The
// references for scripts just auto-increment per session and are entirely
// ephemeral. Remove the reference so that we fall back to a path if possible.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no longer the case, and caused problems. Since a few years ago, we set the source referenced based on a hash of the URL and other information to try to make them stable between reloads, so we should leverage that information.

Copy link
Member

@roblourens roblourens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wat... 😁

I just wonder whether the wat grammar should be in this extension or in the builtin javascript extension, or its own builtin extension

@connor4312
Copy link
Member Author

I think having it be built-in is sensible. I'll move it over on Monday.

@connor4312 connor4312 merged commit 72c0276 into main Aug 27, 2023
10 checks passed
@connor4312 connor4312 deleted the connor4312/basic-wasm-debugging branch August 27, 2023 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug/Question] Breakpoint auto-relocate to other file in V1.78.0
3 participants